<?php
 include_once(APPPATH.'includes/header.php');

 $id = isset($_SESSION['id']) ? $_SESSION['id'] : die('ERROR: NO session'); 
?>
    <div id="container">
    <h1>My Dashboard</h1>
    
    <?php
       
        
	echo 'hello: ' .  $first_name . ' ' . $last_name;
	?>
    <a href='<?=base_url().'user/logout'?>'>logout</a>
    <hr  />
    
    <?php
    /*  
    echo'<pre>';
        print_r($posts);
        echo'</pre>'; // */
      include_once(LIB_PATH . 'query.php');
      foreach($posts as $post)
          {
            $cols = array('name'=>'first_name," ",last_name','photo');
            $user = new QUERY(array('TABLE'=>'member','KEY'=>array('member_id'=>$post['member_id']),'COLS'=>$cols))
          
   ?>
            <div id='postContainer' style='margin:8px; background: #A3CC52;font-family:verdana; border: 1px #009900 solid; padding:2px; width: 50%'>
                
                <div id='postHeader' style='background: #006600; color:#FFF;  padding: 2px'>
                  <span>
                      <img src='<?=USER_THUMB.$user->fetch('photo')?>' width='40px' style=' float: left; padding-right: 3px'> 
                     <?=$user->fetch('name')?>
                  </span>
                    <br />
                  <span><?=$post['title']?><span>
                </div>
                
                <div id='postBody' style='margin:0px; padding: 10px; background: #FFF' ><?=$post['content']?></div>
                <div id='postFoot' style='font-size: 10px'>
                    <span id='spanComments' style='cursor: pointer' onclick='displayComments("<?=$post['post_id']?>")'>comments</span> | 
                    <span><?=date('F m, Y g:i a',  strtotime($post['posted_on']))?></span>
                </div>
            </div>      
 
           <div id='divComment<?=$post['post_id']?>' style='display:none; border: 1px #009900 solid; width: 50%; margin: 8px; padding: 2px'>
                <?='display comments for: ' . $post['post_id']?>
           </div>
    <?php
         unset($user);
          }
    ?>
   </div>

 
<?php
 include_once(APPPATH.'includes/footer.php');
?>